define(function(require, exports){
	//PMP订单管理
	exports.onMain = function(boot,data,app){
		if (!app.routerValid('master.sunfei')) {
			return;
		}
		var con = app.getContainer({
			scenes: 'main',
			full: false,
			sitelist: false,
			setup_btn: false,
			title:LANG('订单管理'),
			type: 'tabSidebar'
		});

		// 首选交易订单
		if(app.checkRight('')){
			con.createBusiness(data.name + 'prev', 'deal/action/list.prev', {
				tabText: LANG('首选交易')
			}, function(mod, created){
				if(created){
					mod.reload();
				}
			});
		}

		// 私下竞价订单
		if(app.checkRight('')){
			con.createBusiness(data.name + 'priv', 'deal/action/list.priv', {
				tabText: LANG('私下竞价')
			}, function(mod, created){
				if(created){
					mod.reload();
				}
			});
		}

		// PDB订单
		if(app.checkRight('')){
			con.createBusiness(data.name + 'pdb', 'deal/action/list.pdb', {
				tabText: LANG('PDB')
			}, function(mod, created){
				if(created){
					mod.reload();
				}
			});
		}
	};


	exports.onEdit = function( boot, data, app ) {
		if (!app.routerValid('master.sunfei')) {
			return;
		}
		var id = +data.param;
		var type = +(data.search && data.search.Type || 1);
		var title;
		switch (type)
		{
			case 1:
				title = LANG('编辑首选交易订单');
				break;
			case 2:
				title = LANG('编辑私下竞价订单');
				break;
			case 3:
				title = LANG('编辑PDB订单');
				break;
		}

		var con = app.getContainer({
			scenes: 'main',
			full: false,
			sitelist: false,
			setup_btn: false,
			title: title,
			type:'scroll'
		});

		con.createBusiness(data.name, 'deal/action/edit.base', {
		}, function(mod) {
			if(mod && id){
				mod.reset().setMode(type, true).load(id);
			} else {
				mod.reset().setMode(type);
			}
		});

	};
});